package com.xike.micromemberserver.config;

/**
 * Auther: wuson  <br/>
 * Date: 2021/3/22:14:06  <br/>
 * Description:
 */
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * RabbitMQ的配置类
 */
@Configuration
public class RabbitmqConfiguration {
    /**
     * 直接路由交换机
     * Direct
     * @return
     */
    @Bean
    public DirectExchange directExchange(){
        //交换机的名称，是否具备持久化特性，当没有连接使用时，是否自动删除
        return new DirectExchange("directExchange",true,false);
    }
    /**
     * 扇形交换机
     * Fanout
     * @return
     */
    @Bean
    public FanoutExchange fanoutExchange(){
        return new FanoutExchange("fanoutExchange",true,false);
    }
    /**
     * 主题交换机
     * Topic
     * @return
     */
    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange("topicExchange",true,false);
    }
}